Skip to content

✨ Add destructurable integer_sequence#335

Merged
elbeno merged 3 commits intointel:mainfrom
elbeno:index-sequence
Mar 5, 2026
Merged

✨ Add destructurable integer_sequence#335
elbeno merged 3 commits intointel:mainfrom
elbeno:index-sequence

Conversation

@elbeno
Copy link
Contributor

@elbeno elbeno commented Mar 5, 2026

Problem:

  • With clang backporting "structured bindings can introduce a pack", it would be very useful to be able to destructure an integer_sequence, to avoid having to do the usual call of an immediately-invoked lambda expression.

Solution:

  • Add make_integer_sequence and make_index_sequence that can be destructured.

Note:

  • This is first available in clang-21.

Problem:
- With clang backporting "structured bindings can introduce a pack", it would be
  very useful to be able to destructure an `integer_sequence`, to avoid having
  to do the usual call of an immediately-invoked lambda expression.

Solution:
- Add `make_integer_sequence` and `make_index_sequence` that can be destructured.

Note:
- This is first available in clang-21.
elbeno added 2 commits March 5, 2026 11:08
Problem:
- It's useful to be able to pass an `integer_sequence` into tuple algorithms
  like `unrolled_for_each`.

Solution:
- Change tuple algorithms to use `get` rather than indexing.
- Add specialization of `tuple_size_v` for `integer_sequence`.
- Add specialization of `get` for `span`.
Problem:
- There is no documentation explaining `stdx::make_integer_sequence` and
  friends.

Solution:
- Add the docs.
@elbeno elbeno merged commit 9d65d90 into intel:main Mar 5, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants